package com.mzj.saas.jobs.lock.executor;

import com.mzj.saas.jobs.lock.service.LockService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 智能锁未开门时间
 */
@JobHandler(value = "lockExecutor")
@Component
public class LockExecutor extends IJobHandler {
    private static Logger log = LoggerFactory.getLogger(LockExecutor.class);

    @Autowired
    private LockService lockService;

    @Override
    public ReturnT<String> execute(String arg0) throws Exception {
        long time = System.currentTimeMillis();

        String result = lockService.work();

        long useTime = System.currentTimeMillis() - time;
        log.info("----> lockExecutor end, result: {}, use time: {}", result, useTime);

        return SUCCESS;
    }


}
